package com.second.hand.trading.server.Exception;

import com.second.hand.trading.server.utils.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class CommonException {
    @ExceptionHandler(Exception.class)
    public R<String> exceptionHandler(Exception err) {
        err.printStackTrace();
        return R.fail("服务忙,请稍后再试");
    }

    @ExceptionHandler(BusinessException.class)
    public R<String> businessExceptionHandler(BusinessException err){
        err.printStackTrace();
        return R.fail(err.getMessage());
    }
}
